package com.ruoyi.common.enums;

/**
 * 会员标识
 * @author zhoudong
 */
public enum IdentityTypeEnum {
    UID(0,"UID","外部ID"),
    EMAIL(1,"EMAIL", "邮箱"),
    MOBILE(2, "MOBILE","手机号"),
    WX(3, "WX","微信"),
    ALIPAY(4, "ALIPAY","支付宝"),
    TB(5, "TB","淘宝"),
    JD(6, "JD","京东"),
    WEIBO(7, "WEIBO","微博"),
    SINA(8, "SINA","新浪"),
    MEMBER_ID(9, "MEMBER_ID","用户ID"),
    HUANXIN(10, "HUANXIN","环信ID"),
    VHALL(11, "VHALL","微吼ID");

    private final long   code;
    private final String   insCode;
    private final String message;

    IdentityTypeEnum(long   code, String insCode, String message) {
        this.code = code;
        this.insCode = insCode;
        this.message = message;
    }

    /**
     * 通过代码获取枚举项
     * @param code
     * @return
     */
    public static IdentityTypeEnum getByCode(long code) {

        for (IdentityTypeEnum le : IdentityTypeEnum.values()) {
            if (le.getCode() == code) {
                return le;
            }
        }

        return null;
    }
    /**
     * 通过代码获取枚举项
     * @param insCode
     * @return
     */
    public static IdentityTypeEnum getByInsCode(String insCode) {
        if (insCode == null) {
            return null;
        }

        for (IdentityTypeEnum le : IdentityTypeEnum.values()) {
            if (le.getInsCode().equalsIgnoreCase(insCode)) {
                return le;
            }
        }

        return null;
    }

    public long getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String getInsCode() {
        return insCode;
    }
}
